package pe.bf.extranet.ejb;

import pe.bf.domain.bean.Empresa;

public class EmpresaEJBProxy implements EmpresaEJB {
  private String _endpoint = null;
  private EmpresaEJB empresaEJB = null;
  
  public EmpresaEJBProxy() {
    _initEmpresaEJBProxy();
  }
  
  public EmpresaEJBProxy(String endpoint) {
    _endpoint = endpoint;
    _initEmpresaEJBProxy();
  }
  
  private void _initEmpresaEJBProxy() {
    try {
      empresaEJB = (new EmpresaEJBServiceLocator()).getEmpresaEJBPort();
      if (empresaEJB != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)empresaEJB)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)empresaEJB)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (empresaEJB != null)
      ((javax.xml.rpc.Stub)empresaEJB)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public EmpresaEJB getEmpresaEJB() {
    if (empresaEJB == null)
      _initEmpresaEJBProxy();
    return empresaEJB;
  }
  
  public void init() throws java.rmi.RemoteException{
    if (empresaEJB == null)
      _initEmpresaEJBProxy();
    empresaEJB.init();
  }
  
  public boolean crearEmpresa(Empresa arg0) throws java.rmi.RemoteException{
    if (empresaEJB == null)
      _initEmpresaEJBProxy();
    return empresaEJB.crearEmpresa(arg0);
  }
  
  public boolean actualizarEmpresa(Empresa arg0) throws java.rmi.RemoteException{
    if (empresaEJB == null)
      _initEmpresaEJBProxy();
    return empresaEJB.actualizarEmpresa(arg0);
  }
  
  public Empresa[] listarEmpresa() throws java.rmi.RemoteException{
    if (empresaEJB == null)
      _initEmpresaEJBProxy();
    return empresaEJB.listarEmpresa();
  }
  
  public boolean bajaEmpresa(Empresa arg0) throws java.rmi.RemoteException{
    if (empresaEJB == null)
      _initEmpresaEJBProxy();
    return empresaEJB.bajaEmpresa(arg0);
  }
  
  
}